/* 
 * File:   ImageHistogramCreator.h
 * Author: Guilherme Monteiro
 *
 */

#ifndef IMAGEHISTOGRAMBASEDONPROJECTIONCREATOR_H
#define	IMAGEHISTOGRAMBASEDONPROJECTIONCREATOR_H
#include <vector>
#include <cv.h>
#include <highgui.h>
#include <cxcore.h>

using namespace std;

/**
 * Class that represents a creator of
 * histograms based on projections (vertical
 * and horizontal) of the image.
 * 
 * @author Guilherme Monteiro
 * 
 */
class ImageHistogramBasedOnProjectionCreator {
public:
    ImageHistogramBasedOnProjectionCreator(IplImage* img);
    ImageHistogramBasedOnProjectionCreator(const ImageHistogramBasedOnProjectionCreator& orig);
    virtual ~ImageHistogramBasedOnProjectionCreator();
    void run();
    IplImage* getImage();
    vector<int> getVerticalProjection();
    vector<int> getHorizontalProjection();
private:
    IplImage* originalImage;
    vector<int> verticalProjection;
    vector<int> horizontalProjection;
    
    vector<double> calculatesVerticalProjection();
    vector<double> calculatesHorizontalProjection();
    IplImage* createImageWithHistogram(vector<double> vProjection, vector<double> hProjection);
    IplImage* fillHistogramWithVerticalProjection(IplImage* imgHist, vector<double> vProjection);
    IplImage* fillHistogramWithHorizontalProjection(IplImage* imgHist, vector<double> hProjection);
};

#endif	/* IMAGEHISTOGRAMBASEDPROJECTIONCREATOR_H */

